package com.senlingspace.web.controller.registry;


import com.senlingspace.common.core.controller.BaseController;
import com.senlingspace.common.core.domain.AjaxResult;
import com.senlingspace.system.service.ISlkjOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.NoSuchElementException;

@RestController
@RequestMapping("/registry/order")
public class OderStatusController extends BaseController {


    @Autowired
    private ISlkjOrderService slkjOrderService;


    //    <!-- 查询订单中可用的票数 -->
    @GetMapping("/ticketNum")
    public AjaxResult ticketUseNum(String orderNumber,Long shopId) {
        Integer  peoNum  = 0;
        try{
            peoNum  =   slkjOrderService.ticketUseNum(orderNumber,shopId);

        }catch (NoSuchElementException e){
            return   error(e.getMessage());
        }
        return  success(peoNum);
    }



    //  查询订单是否是已核销状态（是否可打印）
    @GetMapping("/checkNum")
    public AjaxResult getStatusByOrderNumber(String orderNumber) {
        Boolean status =  slkjOrderService.getStatusByOrderNumber(orderNumber);
        return  success(status);
    }



}
